<?php
include_once ("ext/phpThumb/ThumbLib.inc.php");

$fileName = (isset($_GET['src'])) ? urldecode($_GET['src']) : null;
$fileName = substr($fileName, 1);
$width = (isset($_GET['w'])) ? intval($_GET['w']) : 400;
$heigh = (isset($_GET['h'])) ? intval($_GET['h']) : 400;

/*
 Options
    The options array allows you to customize the behavior of the library a bit. Some of these options are implementation-specific, and are noted as such. So, let’s first go over what options are available to us:
    Option Name 	Description 	Default Value 	Valid Values
    resizeUp 	Whether or not to scale an image up to the desired dimensions 	false 	true / false
    jpegQuality 	What quality to save jpeg files with (how much compression to use, 100 being none) 	100 	1-100
    correctPermissions 	Whether or not the library should attempt to correct file permissions. This will only work if you set up your PHP to allow chmod operations 	false 	true / false
    preserveAlpha 	Whether or not to preserve alpha transparency in PNG files 	true 	true / false
    alphaMaskColor 	What rgb color should be used for the alpha mask 	array(255,255,255) 	array([0-255], [0-255], [0-255])
    preserveTransparency 	Whether or not to preserve transparency in GIF files 	true 	true / false
    alphaMaskColor 	What rgb color should be used for the transparency mask 	array(255,255,255) 	array([0-255], [0-255], [0-255])
 */

$options = array('resizeUp' => true);

if ($fileName === null || !file_exists($fileName)) {

}else {
    $thumb = PhpThumbFactory::create($fileName, $options);
    //$thumb->resize(400, 100);
    //$thumb->resize($width, $heigh);
    //$thumb->adaptiveResize($width, $heigh);
    //$thumb->show();
    $thumb->resize($width+20, $heigh+20)->cropFromCenter($width, $heigh)->show();
}


?>